package org.test.once.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.test.once.manager.*;

import org.test.once.manager.RoleModuleManager;

public class AddModuleRole extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public AddModuleRole() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPost(request,response);
	}

		public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
       int mid=Integer.parseInt(request.getParameter("mid"));
       int rid=Integer.parseInt(request.getParameter("rid"));
       RoleModuleManager rmd=new RoleModuleManager();
       rmd.insert(mid, rid);
       request.getRequestDispatcher("common/pub_update_success.jsp").forward(
				request, response);
		
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
